<template>
  <div class="header">
    <router-link :class="['item', $route.name === menu.name ? 'active' : '']" :to="menu.path" v-for="menu in menus" :key="menu.path">{{
      menu.text
    }}</router-link>
  </div>

  <div class="view">
    <router-view />
  </div>
</template>

<script setup>
import { ref } from 'vue'

const menus = ref([
  {
    text: '拓扑图',
    path: '/topological',
    name: 'Topological',
    icon: 'Topological'
  },
  {
    text: '首页',
    path: '/home',
    name: 'Home',
    icon: 'home'
  },
  {
    text: 'demo',
    path: '/demo',
    name: 'Demo',
    icon: 'demo'
  }
])
</script>

<style scoped lang="scss">
.header {
  width: 100%;
  height: 50px;
  background-color: #000;
  display: flex;
  gap: 10px;
  align-items: center;

  .item {
    width: 100px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
  }

  .item.active {
    background-color: #5f95ff;
  }
}
</style>
